﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Enterprise.Infrastructure;
using Enterprise.Model.Meeting;
using Enterprise.Service.Meeting;
using Enterprise.Service.User;
using Enterprise.Service.Department;
using Enterprise.Control;
namespace Enterprise.UI.Web.Modules.Meeting
{
    public partial class Disp : System.Web.UI.Page
    {
        int Id = (int)Utility.sink("Id", Utility.MethodType.Get, 0, 0, Utility.DataType.Int);
        string from = (string)Utility.sink("from", Utility.MethodType.Get, 0, 0, Utility.DataType.Str);
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                OnCommand();
                OnStart();
            }
        }
        private void OnCommand()
        {
            //添加操作按钮

            
        }

        private void OnStart()
        {
            MeetingService mService = new MeetingService();
            var query = mService.MeetingDisp(Id);
            if (query != null)
            {
                if (query.MUserId == Utility.Get_UserId)
                {
                    CreateBT.AddButton("edit.gif", "修改", "Edit.aspx?Cmd=Edit&Id=" + Id, Utility.PopedomType.Edit, HeadMenu1);
                    CreateBT.AddButton("delete.gif", "删除", "Edit.aspx?Cmd=Delete&Id=" + Id, Utility.PopedomType.Delete, HeadMenu1);
                }
                if (string.IsNullOrEmpty(from))
                {
                    CreateBT.AddButton("back.gif", "返回", "Index.aspx", Utility.PopedomType.List, HeadMenu1);
                }
                else if (from == "Check")
                {
                    CreateBT.AddButton("back.gif", "返回", "CheckIndex.aspx", Utility.PopedomType.List, HeadMenu1);
                }
                lb_User.Text = UserService.GetUserName(query.MUserId);
                lb_Dept.Text = DepartmentService.GetDepartMentName(query.MDepartMent);
                lb_Address.Text = query.MAddress;
                lb_Time.Text = query.MTime.ToString();
                lb_Zcr.Text = query.MZcr;
                t_CreateTime.Text = query.MCreateTime.ToString();
                lb_Title.Text = query.MTitle;
                lb_Title_Ru.Text = query.MTitleRu;
                t_Content.Text = query.MContent;
                t_ContentRu.Text = query.MContentRu;
                lb_Users.Text =UserService.GetUserNameArray( query.MUsers);
            }
        }

    }
}